package com.examples.AppoointmentManager;



import java.util.ArrayList;

import com.examples.Model.AppoinModel;




import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class LIstAdapter extends BaseAdapter {
	
	private ArrayList<AppoinModel> groupResults;
	private LayoutInflater mInflater;
	Context context;
	
	public LIstAdapter(Context context,ArrayList<AppoinModel> results){
		groupResults=results;
		mInflater = LayoutInflater.from(context);
		this.context=context;
	}
	
	@Override
	public int getCount() {
		return groupResults.size();
	}

	@Override
	public Object getItem(int position) {
		return groupResults.get(position);
	}

	@Override
	public long getItemId(int position) {
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder holder;
		if(convertView==null){
			holder = new ViewHolder();
			convertView =mInflater.inflate(com.examples.AppoointmentManager.R.layout.simplelistview, null);
			holder.img=(ImageView) convertView.findViewById(com.examples.AppoointmentManager.R.id.imag1);
			holder.groupName=(TextView) convertView.findViewById(com.examples.AppoointmentManager.R.id.textView1);
			//holder.contactsCount=(TextView) convertView.findViewById(com.groupssms.R.id.groupCount);
			convertView.setTag(holder);
		}else{
			holder = (ViewHolder) convertView.getTag();
		}
	
		holder.groupName.setText(groupResults.get(position).getAgenda());
		
		
		
		return convertView;
	}
	
	static class ViewHolder {
		  int id;   
		  ImageView img;
		  TextView groupName;
	
	}
}
